package com.bluesky.system.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.*;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.bluesky.common.convert.ExcelDictConverter;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.apache.poi.ss.usermodel.HorizontalAlignment;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 菜单表
 * </p>
 *
 * @author Kevin
 * @since 2021-06-19
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ColumnWidth(15)
@HeadRowHeight(15)
@ContentRowHeight(15)
@HeadStyle
@HeadFontStyle(fontHeightInPoints = 12)
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER)
@ContentFontStyle(fontHeightInPoints = 10)
public class SysMenu implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @ExcelIgnore
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /**
     * 菜单类型 dir目录；menu菜单；button按钮
     */
    @ExcelProperty(value = "菜单类型", index = 1, converter = ExcelDictConverter.class)
    private String menuType;

    /**
     * 菜单名称
     */
    @ExcelProperty(value = "菜单名称", index = 0)
    private String menuName;

    /**
     * 上级菜单
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @ExcelIgnore
    private Long parentId;

    @ExcelProperty(value = "上级菜单", index = 3)
    @TableField(exist = false)
    @ExcelIgnore
    private String parentName;

    /**
     * 路由地址
     */
    @ExcelProperty(value = "路由地址", index = 5)
    private String routePath;

    /**
     * 组件路径
     */
    @ExcelProperty(value = "组件路径", index = 6)
    private String component;

    /**
     * 权限标识
     */
    @ExcelProperty(value = "权限标识", index = 7)
    private String permission;

    /**
     * 图标
     */
    @ExcelProperty(value = "图标", index = 2)
    private String icon;

    /**
     * 是否缓存 0缓存；1不缓存
     */
    @ExcelProperty(value = "是否缓存", index = 4, converter = ExcelDictConverter.class)
    private String keepalive;

    /**
     * 是否外链 0是；1否
     */
    @ExcelProperty(value = "是否外链", index = 8, converter = ExcelDictConverter.class)
    private String linkExternal;

    /**
     * 是否显示 0显示；1隐藏
     */
    @ExcelProperty(value = "是否显示", index = 3, converter = ExcelDictConverter.class)
    private String visible;

    /**
     * 是否内嵌 0内嵌；1不内嵌
     */
    @ExcelProperty(value = "是否内嵌", index = 9, converter = ExcelDictConverter.class)
    private String frame;

    /**
     * 外部链接
     */
    @ExcelProperty(value = "外部链接", index = 10)
    private String linkUrl;

    /**
     * 排序
     */
    @ExcelProperty(value = "排序", index = 11)
    private Integer sort;

    /**
     * 备注
     */
    @ExcelProperty(value = "备注", index = 13)
    private String remarks;

    /**
     * 状态 0正常；1停用
     */
    @ExcelProperty(value = "状态", index = 12, converter = ExcelDictConverter.class)
    private String status;

    /**
     * 创建人
     */
    @TableField(fill = FieldFill.INSERT)
    @ExcelIgnore
    private String createdBy;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @ExcelIgnore
    private Date createdTime;

    /**
     * 更新人
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ExcelIgnore
    private String updatedBy;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @ExcelIgnore
    private Date updatedTime;

    @ExcelIgnore
    @TableField(exist = false)
    private List<SysMenu> children;
}